Page({

    /**
     * 页面的初始数据
     */
    
    data: {
        class1: 'z1', //默认正面在上面
        class2: 'z2',
        class3: 'z3',//默认正面在上面
        class4: 'z4',
        class5: 'z5',//默认正面在上面
        class6: 'z6',
        class7: 'z7',//默认正面在上面
        class8: 'z8',
        class9: 'z9',//默认正面在上面
        class10: 'z10',
        class11: 'z11',//默认正面在上面
        class12: 'z12',
        class13: 'z13',//默认正面在上面
        class14: 'z14',
        class15: 'z15',//默认正面在上面
        class16: 'z16',
        class17: 'z17',//默认正面在上面
        class18: 'z18',
    },
    //第一张
    rotateFn: function(e) {
        let data = this.data;
        if (data.class1 == 'z1' && data.class2 == 'z2') {
            this.run('front', 'back', 'z2', 'z1');
        } else {
            this.run('back', 'front', 'z1', 'z2');
        }
    },
    run: function(a, b, c, d) {
        let that = this;
        that.setData({
            class1: a,
            class2: b,
        })
        setTimeout(function() {
            that.setData({
                class1: c,
                class2: d,
            })
        }, 1000);
    },

    //第二张
    rotateFn2: function(e) {
        let data = this.data;
        if (data.class3 == 'z3' && data.class4 == 'z4') {
            this.wys('front', 'back', 'z4', 'z3');
        } else {
            this.wys('back', 'front', 'z3', 'z4');
        }
    }, 
    wys: function(a, b, c, d) {
        let that = this;
        that.setData({
            class3: a,
            class4: b,
        })
        setTimeout(function() {
            that.setData({
                class3: c,
                class4: d,
            })
        }, 1000);
    },


    //第三张
    rotateFn3: function(e) {
        let data = this.data;
        if (data.class5 == 'z5' && data.class6 == 'z6') {
            this.sdda('front', 'back', 'z6', 'z5');
        } else {
            this.sdda('back', 'front', 'z5', 'z6');
        }
    }, 
    sdda: function(e, f, g, h) {
        let that = this;
        that.setData({
            class5: e,
            class6: f,
        })
        setTimeout(function() {
            that.setData({
                class5: g,
                class6: h,
            })
        }, 1000);
    },

    //第四张
    rotateFn4: function(e) {
        let data = this.data;
        if (data.class7 == 'z7' && data.class8 == 'z8') {
            this.wy2('front', 'back', 'z8', 'z7');
        } else {
            this.wy2('back', 'front', 'z7', 'z8');
        }
    }, 
    wy2: function(a, b, c, d) {
        let that = this;
        that.setData({
            class7: a,
            class8: b,
        })
        setTimeout(function() {
            that.setData({
                class7: c,
                class8: d,
            })
        }, 1000);
    },


    //第五张
    rotateFn5: function(e) {
        let data = this.data;
        if (data.class9 == 'z9' && data.class10 == 'z10') {
            this.sdd('front', 'back', 'z10', 'z9');
        } else {
            this.sdd('back', 'front', 'z9', 'z10');
        }

    },
    sdd: function(a, b, c, d) {
        let that = this;
        that.setData({
            class9: a,
            class10: b,
        })
        setTimeout(function() {
            that.setData({
                class9: c,
                class10: d,
            })
        }, 1000);
    },



    //第六张
    rotateFn6: function(e) {
        let data = this.data;
        if (data.class11 == 'z11' && data.class12 == 'z12') {
            this.wyb('front', 'back', 'z12', 'z11');
        } else {
            this.wyb('back', 'front', 'z11', 'z12');
        }
    },
    wyb: function(a, b, c, d) {
        let that = this;
        that.setData({
            class11: a,
            class12: b,
        })
        setTimeout(function() {
            that.setData({
                class11: c,
                class12: d,
            })
        }, 1000);
    },

    //第七张
    rotateFn7: function(e) {
        let data = this.data;
        if (data.class13 == 'z13' && data.class14 == 'z14') {
            this.wangying2('front', 'back', 'z14', 'z13');
        } else {
            this.wangying2('back', 'front', 'z13', 'z14');
        }
    },
    wangying2: function(a, b, c, d) {
        let that = this;
        that.setData({
            class13: a,
            class14: b,
        })
        setTimeout(function() {
            that.setData({
                class13: c,
                class14: d,
            })
        }, 1000);
    },

    //第八张
    rotateFn8: function(e) {
        let data = this.data;
        if (data.class15 == 'z15' && data.class16 == 'z16') {
            this.wangyingben('front', 'back', 'z16', 'z15');
        } else {
            this.wangyingben('back', 'front', 'z15', 'z16');
        }
    },
    wangyingben: function(a, b, c, d) {
        let that = this;
        that.setData({
            class15: a,
            class16: b,
        })
        setTimeout(function() {
            that.setData({
                class15: c,
                class16: d,
            })
        }, 1000);
    },


    //第九张
    rotateFn9: function(e) {
        let data = this.data;
        if (data.class17 == 'z17' && data.class18 == 'z18') {
            this.wangyingsha('front', 'back', 'z18', 'z17');
        } else {
            this.wangyingsha('back', 'front', 'z17', 'z18');
        }
        wx.showToast({
            title: '恭喜你集齐一个新的贴纸，即将为你跳转隐藏款界面',
            icon: 'none',
            duration: 1500,
            success: function () {
             //弹窗后执行，可以省略
             setTimeout(function () {
                wx.reLaunch({
                 url: '/pages/shopHidden/hidden',
                    })
                  }, 1500);
              }
            })
    },
    wangyingsha: function(a, b, c, d) {
        let that = this;
        that.setData({
            class17: a,
            class18: b,
        })
        setTimeout(function() {
            that.setData({
                class17: c,
                class18: d,
            })
        }, 1000);
    },

    
    







     /**
     * 签到获取
     
    butt(){
        wx.showToast({
          title: '即将为你跳转隐藏款界面',
          icon: 'none',
          duration: 1500,
          success: function () {
           //弹窗后执行，可以省略
           setTimeout(function () {
              wx.reLaunch({
               url: '/pages/shopHidden/hidden',
                  })
                }, 1500);
            }
          })
    },*/
    /**
     * 上一页
     */
    gotoPage1:function(){
        wx.navigateTo({
          url: '../shopAttendance/attendance',
        })
    },


    /**
     * 下一页
     */
    gotoPage2:function(){
        wx.showToast({
            title: '这就是最后一页哦',
            icon: 'none',
            })
    },


    /**
     * 生命周期函数--监听页面加载
     */
    onLoad(options) {

    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady() {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow() {

    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide() {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload() {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh() {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom() {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage() {

    }
})